// HelpUtils.cpp

#include "StdAfx.h"

#include <HtmlHelp.h>

#include "Common/StringConvert.h"
#include "HelpUtils.h"
#include "ProgramLocation.h"
#include "RegistryUtils.h"

// 8zip, not used any more, commented out
//static LPCWSTR kHelpFileName = L"7-zip.chm::/";

void ShowHelpWindow(HWND hwnd, LPCWSTR topicFile)
{
  UString path;
  if (!::GetProgramFolderPath(path))
    return;

  // 8zip patch
  UString localeHelpFileName, str;
  ReadRegLang(str);
  str.MakeLower();
  if(!str.Compare(L"zh-cn"))
    localeHelpFileName=L"Help/zh-cn.chm::/";
  else
  if(!str.Compare(L"zh-tw"))
    localeHelpFileName=L"Help/zh-tw.chm::/";
  else
    localeHelpFileName=L"Help/en.chm::/";

  //path += kHelpFileName;
  path += localeHelpFileName;
  path += topicFile;
  HtmlHelp(hwnd, GetSystemString(path), HH_DISPLAY_TOPIC, NULL);
}


